var read_line = require('readline-sync')
read_line.setDefaultOptions({ prompt: '' })
var read_line = read_line.prompt
let arr = read_line().split(' ') // 分隔成数组
let res = '' // 初始化结果
let flag = true // 只打印一次
for (let i = 0; i < arr[0].length && flag; i++) {
  for (let j = 1; j < arr.length && flag; j++) {
    if (arr[j][i] !== arr[0][i]) {
      flag = false
      console.log(res)
      break
    }
  }
  res += arr[0][i]
}
if (flag) {
  console.log(res)
}